package com.hrm.houfei.jsonfactory.moneystandard;

import java.util.List;

import com.hrm.houfei.jsontools.JSONArray;
import com.hrm.houfei.jsontools.JSONObject;
import com.hrm.houfei.po.Moneydetails;
import com.hrm.houfei.po.Moneyinfo;

public class ConvertListToJson {

	public ConvertListToJson() {
		super();
	}

	/**
	 * 将List<Moneydetails>转为json数据格式
	 * 
	 * @param list
	 *            List<Moneydetails>
	 * @return json
	 */
	public static String converListToJson(List<Moneydetails> list) {
		JSONArray jsonArray = new JSONArray();
		JSONObject jsonObject = null;
		for (Moneydetails md : list) {
			jsonObject = new JSONObject(md);
			jsonArray.put(jsonObject);
		}
		String json = jsonArray.toString();
		return json;
	}
	
	/**
	 * 将List<Moneydetails>转为json数据格式
	 * 
	 * @param list
	 *            List<Moneydetails>
	 * @return json
	 */
	public static String converListToJsonMoneyInfo(List<Moneyinfo> list) {
		JSONArray jsonArray = new JSONArray();
		JSONObject jsonObject = null;
		for (Moneyinfo md : list) {
			jsonObject = new JSONObject(md);
			jsonArray.put(jsonObject);
		}
		String json = jsonArray.toString();
		return json;
	}

}
